<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    li {
      background-color: pink;
    }
  </style>
</head>

<body>
  <input type="text" id="input">
  <ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
  </ul>

  <script>
    // const li = document.querySelectorAll('li');
    // li.forEach((item, index) => {
    //   item.addEventListener('click', () => {
    //     console.log(item.innerText);
    //   });
    // });

  </script>

  <script>
    let ul = document.querySelector('ul')
    ul.addEventListener('click', function (e) {
      console.log(e.target.innerText);
    });

    let input = document.querySelector('#input')
    input.addEventListener('input', function () {
      console.log(this.value);

    })
  </script>
</body>

</html>